function sendLog(action) {
    $.ajax({
        url:"http://192.168.102.3/log",
        type:"POST",
        async:false,
        data: getData(action),
        dataType:"json",
        success:function (data) {
        },
        error:function () {
            alert("失败")
        }
    })
}

function getData(action) {
    let actTime = new Date().getTime();
    let userId = sessionStorage.getItem("user_id");
    let jobCode = sessionStorage.getItem("job_code");
    let result = {}
    result["user_id"] = userId == null ? "" : userId;
    result["act_time"] = actTime;
    result["action"] = action;
    result["jobCode"] = jobCode == null ? "" : jobCode;
    return result;
}

function login() {
    sessionStorage.setItem("user_id", "1");
    sessionStorage.setItem("job_code", "1");
    sendLog("login");
    window.location.href = "user.html";
}

function logout() {
    sessionStorage.removeItem("user_id");
    sessionStorage.removeItem("job_code");
    sendLog("logout");
    window.location.href = "index.html";
}

function click() {
    sendLog("click");
}


function job_collect() {
    sendLog("job_collect");
}

function cv_send() {
    sendLog("cv_send");
}

function cv_upload() {
    sendLog("cv_upload");
}